package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpContractsNewPageUtil extends SeleniumPageUtil{
	public final static By CTN_IMG_HEAD_TITLE = By.xpath("//*[@id='form1']/table/tbody/tr/td/span[1]");
	public final static By CTN_LINK_SEARCH = By.id("ContractHdr1_btnSave");
	public final static By CTN_LINK_CLEAR = By.id("ContractHdr1_btnDone");
	public final static By CTN_SPAN_TOP_TITLE = By.id("ContractHdr1_lblHdr");
	public final static By CTN_TD_CONTRACT_ID = By.xpath("//*[@id='tblEdit']/tbody/tr[1]/td[1]");
	public final static By CTN_INPUT_CONTRACT_ID = By.id("ContractHdr1_txtContractID");
	public final static By CTN_TD_CURR_VISIOIN = By.xpath("//*[@id='tblEdit']/tbody/tr[1]/td[3]");
	public final static By CTN_INPUT_CURR_VISION = By.id("ContractHdr1_txtCurrentRevision");
	public final static By CTN_INPUT_SUB_VISION = By.id("ContractHdr1_txtSubVersion");
	public final static By CTN_TD_DESC = By.xpath("//*[@id='tblEdit']/tbody/tr[1]/td[5]");
	public final static By CTN_INPUT_DESC = By.id("ContractHdr1_txtDescription");
	public final static By CTN_TD_SUPPLIER = By.xpath("//*[@id='tblEdit']/tbody/tr[1]/td[7]");
	public final static By CTN_SELECT_SUPPLIER = By.id("ContractHdr1_cboSupplierID");
	public final static By CTN_TD_BILL_CYCLE = By.xpath("//*[@id='tblEdit']/tbody/tr[2]/td[1]");
	public final static By CTN_SELECT_BILL_CYCLE = By.id("ContractHdr1_cboContBillingCycleID");
	public final static By CTN_TD_START_DATE = By.xpath("//*[@id='tblEdit']/tbody/tr[2]/td[3]");
	public final static By CTN_INPUT_START_DATE = By.id("ContractHdr1_txtContractStartDate");
	public final static By CTN_IMG_START_DATE = By.id("ContractHdr1_imgContractStartDate");
	public final static By CTN_TD_SERVICE = By.xpath("//*[@id='tblEdit']/tbody/tr[2]/td[5]");
	public final static By CTN_TD_STATUS = By.xpath("//*[@id='tblEdit']/tbody/tr[3]/td[1]");
	public final static By CTN_SELECT_STATUS = By.id("ContractHdr1_cboContractStatusID");
	public final static By CTN_TD_END_DATE = By.xpath("//*[@id='tblEdit']/tbody/tr[3]/td[3]");
	public final static By CTN_INPUT_END_DATE = By.id("ContractHdr1_txtContractStopDate");
	public final static By CTN_IMG_END_DATE = By.id("ContractHdr1_cboContractStatusID");
	public final static By CTN_TD_RENEWAL_STATUS = By.xpath("//*[@id='tblEdit']/tbody/tr[3]/td[5]");
	public final static By CTN_SELECT_RENEWAL_STATUS = By.id("ContractHdr1_cboRenewalStatusID");
	public final static By CTN_TD_VIEW_SMS = By.xpath("//*[@id='ContractHdr1_trPublicFlag']/td[2]");
	public final static By CTN_CHECKBOX_VIEW_SMS = By.id("ContractHdr1_chkPublicFlag");

	public static void enter(){
		SpHomePageUtil.enter();
		SpHomePageUtil.changeCustomer("SMS MASTER");
		SpHomePageUtil.enterContractsNew();
		waitForPageToLoad();
	}

	private static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				CTN_LINK_SEARCH, CTN_LINK_CLEAR, CTN_SELECT_SUPPLIER, CTN_SELECT_BILL_CYCLE,
				CTN_SELECT_STATUS, CTN_SELECT_RENEWAL_STATUS, CTN_CHECKBOX_VIEW_SMS
		});
	}
}
